package com.nervenets.web.entity;


import com.nervenets.web.enumeration.MethodType;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by joe on 17-5-15.
 */
public class MethodTypeModel implements Serializable {
    private MethodType methodType;
    private List<ParamModel> apis;

    public MethodTypeModel(MethodType methodType) {
        this.methodType = methodType;
    }

    public void addApi(ParamModel paramModel) {
        if(null == apis) apis = new ArrayList<ParamModel>();
        apis.add(paramModel);
    }

    public MethodType getMethodType() {
        return methodType;
    }

    public void setMethodType(MethodType methodType) {
        this.methodType = methodType;
    }

    public List<ParamModel> getApis() {
        return apis;
    }

    public void setApis(List<ParamModel> apis) {
        this.apis = apis;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MethodTypeModel that = (MethodTypeModel) o;

        if (methodType != that.methodType) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return methodType != null ? methodType.hashCode() : 0;
    }
}
